package de.guidoludwig.jtm.client.shows;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenuBar;

import de.guidoludwig.af.AFProperties;
import de.guidoludwig.af.Application;

public class ShowApplication implements Application {

	public static ShowApplication INSTANCE = new ShowApplication();

	private static AFProperties PROPERTIES = new AFProperties(
			ShowApplication.class);

	private Action addAction;
	private Action deleteAction;

	private ShowApplication() {
		initActions();
	}

	@Override
	public Icon getIcon() {
		return PROPERTIES.getIcon("application.icon");
	}

	@Override
	public String getShortName() {
		return PROPERTIES.getString("application.shortName");
	}

	@Override
	public String getTitle() {
		return PROPERTIES.getString("application.title");
	}

	private void initActions() {
		if (addAction != null) {
			return;
		}
		addAction = new AddShowAction();
		deleteAction = new DeleteShowAction();
	}

	@Override
	public boolean allowsExit() {
		return true;
	}

	@Override
	public JComponent getComponent() {
		ShowsHomeView view = new ShowsHomeView(ShowsHomeModel.getInstance());
		return view.buildPanel();
	}

	@Override
	public Action[] getToolbarActions() {
		return new Action[] { addAction, deleteAction };
	}

	@Override
	public JMenuBar getMenuBar() {
		// FIXME Auto-generated method stub
		return null;
	}

	@Override
	public void activate() {
		// Nothing to activate
	}

}
